package com.dkm.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "trace")
public class Trace {

	@Id
	private String trace_id;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date trace_time;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date next_trace_time;
	private String remark;
	private String trace_type;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date create_time;
	private String trace_status;
	
	//跟踪和用户多对一关系
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	private Users user;
	
	//跟踪和学生一对一关系
	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "student_id",referencedColumnName = "sid")
	private Student student;
	
	public Users getUser() {
		return user;
	}
	public void setUser(Users user) {
		this.user = user;
	}
	public Student getStudent() {
		return student;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	public Trace() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Trace(String trace_id, Date trace_time, Date next_trace_time, String remark, String trace_type,
			Date create_time, String trace_status) {
		super();
		this.trace_id = trace_id;
		this.trace_time = trace_time;
		this.next_trace_time = next_trace_time;
		this.remark = remark;
		this.trace_type = trace_type;
		this.create_time = create_time;
		this.trace_status = trace_status;
	}
	public String getTrace_id() {
		return trace_id;
	}
	public void setTrace_id(String trace_id) {
		this.trace_id = trace_id;
	}
	public Date getTrace_time() {
		return trace_time;
	}
	public void setTrace_time(Date trace_time) {
		this.trace_time = trace_time;
	}
	public Date getNext_trace_time() {
		return next_trace_time;
	}
	public void setNext_trace_time(Date next_trace_time) {
		this.next_trace_time = next_trace_time;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getTrace_type() {
		return trace_type;
	}
	public void setTrace_type(String trace_type) {
		this.trace_type = trace_type;
	}
	public Date getCreate_time() {
		return create_time;
	}
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	public String getTrace_status() {
		return trace_status;
	}
	public void setTrace_status(String trace_status) {
		this.trace_status = trace_status;
	}
	@Override
	public String toString() {
		return "Trace [trace_id=" + trace_id + ", trace_time=" + trace_time + ", next_trace_time=" + next_trace_time
				+ ", remark=" + remark + ", trace_type=" + trace_type + ", create_time=" + create_time
				+ ", trace_status=" + trace_status + "]";
	}
	
}
